using System;
using System.Xml;
using InfoJetSoft.Service.Entity;

namespace InfoJetSoft.Service.Entity {

	public class DataWSAdapter : DataWebAdapter, ICloneable
	{

		public string WsdlUrl {
			get {
				return wsdlUrl;
			}	
			set {
				this.wsdlUrl = value;
			}
		}

		public string ServiceUrl {
			get {
				return serviceUrl;
			}	
			set {
				this.serviceUrl = value;
			}
		}

		public string SoapAction {
			get {
				return soapAction;
			}	
			set {
				this.soapAction = value;
			}
		}

		public string OperationName {
			get {
				return operationName;
			}	
			set {
				this.operationName = value;
			}
		}

		public string SoapPrefix {
			get {
				return soapPrefix;
			}	
			set {
				this.soapPrefix = value;
			}
		}

		public DataInput Input {
			get {
				return input;
			}	
			set {
				this.input = value;
			}
		}

		public bool QueryAllowed
		{
			get
			{
				return this.queryAllowed;
			}
			set
			{
				this.queryAllowed = value;
			}
		}

		public bool SubmitAllowed
		{
			get
			{
				return this.submitAllowed;
			}
			set
			{
				this.submitAllowed = value;
			}
		}

		public bool UseDataSet
		{
			get
			{
				return this.useDataSet;
			}
			set
			{
				this.useDataSet = value;
			}
		}

				
		public XmlDocument SubmitSchemaDoc 
		{
			get 
			{
				return submitSchemaDoc;
			}
			
			set 
			{
				this.submitSchemaDoc = value;
			}
		}

        public int Timeout
        {
            get
            {
                return this.timeout;
            }
            set
            {
                this.timeout = value;
            }
        }
        
		private string wsdlUrl = null;
		private string serviceUrl = null;
		private string soapAction = null;
		private string operationName = null;
		private string soapPrefix = null;
		private DataInput input = null;
		private bool queryAllowed = false;
		private bool submitAllowed = false;
		private bool useDataSet = false;
        //CID 0941 //2011.06.05 //Begin
        private int timeout = -1; //DefaultValue 30 is Not supported.
        //CID 0941 //2011.06.05 //End
		private XmlDocument submitSchemaDoc = null;

		public Object Clone()
		{
			return this.MemberwiseClone();
		}

		public static string getCurrentServiceUrl( Manifest manifest, DataWSAdapter wsAdapter )
		{
			string customServiceUrl = manifest.FormConfiguration.GetCustomWebServiceUrl( wsAdapter.Name );
			if( customServiceUrl != null )
			{
				return customServiceUrl;
			}
			else
			{
				return wsAdapter.ServiceUrl;
			}
		}

	}

}
